<?php

require_once 'include/Client.php';

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SMS
 *
 * @author jack
 */
class LHWApp_SMS
{

    private $type;

    public function __construct($type)
    {
        $this->type = $type;
    }

    public function sendSMS($mobile, $content = '')
    {
        //content = $content . "【天河艺海（北京）网络科技有限公司】";
        if ($this->type == 1) {
            return $this->getRequest('http://106.ihuyi.com/webservice/sms.php?method=Submit&account=cf_iyiren&password=nz88T9&mobile=' . $mobile . '&content=' . $content);
        }
        if ($this->type == 2) {
            $this->getRequest('http://sdk.univetro.com.cn:6200/sdkproxy/regist.action?cdkey=7SDK-LHW-0588-KFWON&password=898404');
            return $this->getRequest('http://sdk.univetro.com.cn:6200/sdkproxy/sendsms.action?cdkey=7SDK-LHW-0588-KFWON&password=898404&phone=' . $mobile . '&message=' . $content . '&seqid=123&addserial=');
        }
    }

    public function getRequest($url)
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 获取数据返回
        curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); // 在启用 CURLOPT_RETURNTRANSFER 时候将获取数据返回
        return curl_exec($ch);
    }

}

?>
